/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sessions;

import entities.Account;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author kheirarahali
 */
@Stateless
public class AccountFacade extends AbstractFacade<Account> implements AccountFacadeLocal, AccountFacadeRemote {
    @PersistenceContext(unitName = "EcomEntrepriseApp-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public AccountFacade() {
        super(Account.class);
    }

    @Override
    public String getResult() {
        return("C'est ok pour cette session bean");
    }
    
    @Override
    public List<Account> getAllAccounts() {
        return em.createQuery("SELECT a FROM Account a").getResultList();
    }
    
}
